package com.cbs.java.component.network.sample;

import com.cbs.java.component.network.HttpClient;
import com.cbs.java.component.network.Request;
import com.cbs.java.component.network.Response;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;

/**
 * Created by broche on 05/08/2017.
 */
public final class Main {
    public static void main(String[] args) throws IOException {
        HttpClient.Builder builder = new HttpClient.Builder();
        builder.getOkBuilder().proxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("cephei.xuym.me", 1010)));
        HttpClient httpClient = builder.build();

        String url = "http://t66y.com/index.php";
//        String url = "http://www.baidu.com";
        Request request = new Request(url);
        Response response = httpClient.sendSync(request);
        System.out.println(response.desc());
    }
}
